package com.example.travel.service.impl;

import com.example.travel.entity.*;
import com.example.travel.entity.bo.OrderformBO;
import com.example.travel.entity.dto.*;
import com.example.travel.mapper.AdminSelectMapper;
import com.example.travel.service.IAdminSelectService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AdminSelectService implements IAdminSelectService {

    @Autowired
    private AdminSelectMapper adminSelectMapper;

    @Override
    public int queryRegNumber() {
        return adminSelectMapper.queryRegNumber();
    }

    @Override
    public PageInfo<User> queryUserPage(UserDTO userDTO) {
        PageHelper.startPage(userDTO.getPageNum(),userDTO.getPageSize());
        List<User> list = adminSelectMapper.queryUserPage(userDTO);
        return new PageInfo<>(list);
    }

    @Override
    public PageInfo<OrderformBO> queryOrderForm(OrderformDTO orderformDTO) {
        PageHelper.startPage(orderformDTO.getPageNum(),orderformDTO.getPageSize());
        List<OrderformBO> list = adminSelectMapper.queryOrderForm(orderformDTO);
        return new PageInfo<>(list);
    }

    @Override
    public PageInfo<Hotel> queryHotelInformation(HotelDTO hotelDTO) {
        PageHelper.startPage(hotelDTO.getPageNum(),hotelDTO.getPageSize());
        List<Hotel> list = adminSelectMapper.queryHotelInformation(hotelDTO);
        return new PageInfo<>(list);
    }

    @Override
    public PageInfo<OrderformBO> queryScenicOrderForm(OrderformDTO orderformDTO) {
        PageHelper.startPage(orderformDTO.getPageNum(),orderformDTO.getPageSize());
        List<OrderformBO> list = adminSelectMapper.queryScenicOrderForm(orderformDTO);
        return new PageInfo<>(list);
    }

    @Override
    public PageInfo<Scenic> queryScenicInformation(ScenicDTO scenicDTO) {
        PageHelper.startPage(scenicDTO.getPageNum(),scenicDTO.getPageSize());
        List<Scenic> list = adminSelectMapper.queryScenicInformation(scenicDTO);
        return new PageInfo<>(list);
    }

    @Override
    public List<ScenicImg> queryScenicBannerInformation() {
        return adminSelectMapper.queryScenicBannerInformation();
    }

    @Override
    public PageInfo<Festival> queryFestivalInformation(FestivalDTO festivalDTO) {
        PageHelper.startPage(festivalDTO.getPageNum(),festivalDTO.getPageSize());
        List<Festival> list = adminSelectMapper.queryFestivalInformation(festivalDTO);
        return new PageInfo<>(list);
    }

    @Override
    public int selectHotelOrderNumber() {
        return adminSelectMapper.selectHotelOrderNumber();
    }

    @Override
    public int selectScenicOrderNumber() {
        return adminSelectMapper.selectScenicOrderNumber();
    }

    @Override
    public PageInfo<Leave> queryLeave(LeaveDTO leaveDTO) {
        PageHelper.startPage(leaveDTO.getPageNum(),leaveDTO.getPageSize());
        List<Leave> list = adminSelectMapper.queryLeave(leaveDTO);
        return new PageInfo<>(list);
    }
}
